home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 3.8 KB | 143 lines | [TEXT/MPS ] |
- // UCPlusTool.h
- // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
-
- //----------------------------------------------------------------------------------------
- // Simple framework for an MPW tool. NOTE - tools cannot currently be built with -debug
- //----------------------------------------------------------------------------------------
-
- #ifndef __UCPLUSTOOL__
- #define __UCPLUSTOOL__
-
- // MacApp
-
- #ifndef __UOBJECT__
- #include "UObject.h"
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------------
-
- extern const char* gCPlusToolVersion;
- extern const char* kErrorMarker;
-
- //----------------------------------------------------------------------------------------
- // typedefs and structs
- //----------------------------------------------------------------------------------------
- struct KeyWordStruct
- {
- char * keyword;
- short keyvalue;
- };
-
- // Keyword IDs. Negative numbers reserved for the framework
- enum
- {
- kwP = -1000,
- kwNoP,
- kwT,
- kwNoT,
- kwHelp
- };
-
-
- //----------------------------------------------------------------------------------------
- // Forward and external classes
- //----------------------------------------------------------------------------------------
-
- class TAssociation;
-
-
- //----------------------------------------------------------------------------------------
- // TCPlusTool
- //----------------------------------------------------------------------------------------
-
- class TCPlusTool : public TObject
- {
- MA_DECLARE_CLASS;
-
- public:
- TCPlusTool();
- // Constructor
- virtual ~TCPlusTool();
- // Destructor
-
- void ICPlusTool(int argc, char** argv);
- // Pass the argc and argv passed into your main.
-
- virtual void InstallKeyWord(const CStr255& keyword, short kw);
-
- virtual Boolean LookupKeyword(const CStr255& keyword, short& kw);
-
- virtual void InstallKeyWords();
-
- virtual void DoProcessFileArg(const CStr255& arg);
-
- virtual void DoProcessOptionArg(short kw);
-
- virtual void DoShowUsage();
-
- virtual void DoStartProgress();
-
- virtual void DoToolAction();
-
- virtual void GetNextArg(CStr255& nextArg);
-
- virtual void ProcessArg(const CStr255& arg);
-
- virtual void Run();
-
- virtual void Stop(const CStr255& msg);
-
- virtual void SyntaxError(const CStr255& suffix);
-
- //----------------------------------------------------------------------------------------
- // data members
- //----------------------------------------------------------------------------------------
- public:
-
- TAssociation* fKeyWordList; // keywords to this command
-
- CStr255 fProgName; // Program's file name
-
- long fStartTicks; // tickcount at start of tool
-
- long fStartDateTime; // Date/ Time at start of tool
-
- char** fArgv; // command line arguments.
-
- int fArgc; // number of command line arguments
-
- int fArgvIndex; // current argument being processed
-
- short fCursorCount;
-
- enum
- { // for our spinning cursor
- RC_Normal, RC_ParmErrs, RC_DontMatch, RC_Abort
- } fRetCode; // Return codes
-
- Boolean fInterrupted; // True ==> interrupted (command "." pressed)
-
- Boolean fProgress; // True for progress request
-
- Boolean fTime; // True for elapsed time request
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // Unit intialization
- //----------------------------------------------------------------------------------------
-
- extern void InitUCPlusTool();
-
-
- //----------------------------------------------------------------------------------------
- // Globals defined by this unit
- //----------------------------------------------------------------------------------------
-
- extern TCPlusTool* gCPlusTool; // The tool
-
- #endif // __UCPLUSTOOL__
-